$(function() {

  $("#big-show").elevateZoom({
    zoomType: "lens",
    lensShape: "round",
    lensSize: 200
  });
  $('.prod-thumb').click(function() {
    var el = $(this);
    $('.prod-thumb').removeClass('active');
    el.addClass('active');
    $('#big-show').fadeOut(800, function() {
      $('#big-show').attr('src', el.data('src')).fadeIn(800);
    });
    var ez = $("#big-show").data('elevateZoom');
    ez.swaptheimage(el.data('src'), el.data('zoom-image'));
  });

  var _tragg = $('.anchorMenu').offset().top;
  var _menu = $('.anchorMenu');
  $(window).on("scroll", function() {
    var st = $(window).scrollTop();

    st >= _tragg ? _menu.addClass("fixed") : _menu.removeClass("fixed");
  });
  if (app.getBreakpoint() != "xs") {
    $('.ppd').click(function() {
      $('.infoBlockExt').hide();
      $('#' + $(this).data('ref')).fadeIn();
    });
  }


  window.InfoBlock = {};
  InfoBlock.close = function() {
    $('.infoBlockExt').fadeOut();
  }


  $('.img-pod').click(function() {
    $('#featuresSlideshow').show();
    $('#featuresGrid').hide();
  });

  window.FeatureSlideshow = {};
  FeatureSlideshow.close = function() {
    $('#featuresSlideshow').hide();
    $('#featuresGrid').show();

  }
  var autoScaleSlider = true;
  if (app.getBreakpoint() == "xs") {
    autoScaleSlider = false;
  }
  $('.royalSlider').royalSlider({
    controlNavigation: 'thumbnails',
    autoScaleSlider: autoScaleSlider,
    //autoScaleSliderWidth: 960,     
    //autoScaleSliderHeight: 850,
    loop: false,
    imageScaleMode: 'fill',
    navigateByClick: true,
    numImagesToPreload: 2,
    arrowsNav: true,
    arrowsNavAutoHide: true,
    arrowsNavHideOnTouch: true,
    keyboardNavEnabled: true,
    fadeinLoadedSlide: true,
    globalCaption: true,
    globalCaptionInside: false,
    thumbs: {
      appendSpan: true,
      firstMargin: true,
      paddingBottom: 4
    }
  });
  $('#featuresSlideshow').hide();

  $('.anchorMenu a').smoothScroll({
    offset: -70
  });

  if (app.getBreakpoint() == "xs") {
    $('#featuresSlideshow').show();
    $('#featuresGrid').hide();
  }
  /*  var tween = TweenMax.fromTo('.anchorMenu', 1, {
      "position": "auto"
    }, {
      "position": "fixed"
    });*/

  var sence = new ScrollMagic.Scene({
      triggerElement: '.anchorMenu',

    }).setTween(tween)
    .addTo(scrollMagicController);
});